package com.decoration.basic.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import com.decoration.basic.util.SignUtil;
import com.decoration.basic.util.SnowFlake;
import org.springframework.stereotype.Service;

import com.decoration.basic.entity.DecCarouselBase;
import com.decoration.basic.entity.DecorationPicture;
import com.decoration.basic.mapper.DecPictureMapper;
import com.decoration.basic.entity.DecCarouselBase;
import com.decoration.basic.service.DecPictureService;

@Service
public class DecPictureServiceImpl implements DecPictureService {
	@Resource
	private DecPictureMapper pictureMapper;

	@Override
	public Boolean add(String operId,String picAdd,String picName) {
		DecorationPicture picture = new DecorationPicture();
		picture.setPicInfId(String.valueOf(SnowFlake.getInstance().nextId()));
		picture.setPicAddress(picAdd);
		picture.setOldPicName(picName);
//		picture.setUserId("");
//		picture.setCtcId("");
//		picture.setDailyId("");
//		picture.setCaseId("");
//		picture.setFirFlag("");
//		picture.setPicRank("");
		picture.setPicName(SignUtil.getFileName(picAdd));
		picture.setCreateId(operId);
		picture.setCreateTime(new Date());
		int res = pictureMapper.addcommon(picture);
		if (res != 1) {
			return false;
		}
		return true;
	}

	@Override
	public Boolean add(DecorationPicture picture) {

		int res = pictureMapper.addcommon(picture);
		if (res != 1) {
			return false;
		}
		return true;
	}

	@Override
	public List<DecCarouselBase> findCaRousel() {
		return pictureMapper.findCaRousel();
	}

	@Override
	public List<String> findCtcRelById(String ctcid, Integer picture) {
		return null;
	}

   /* public List<DecCarouselBase> findCaRousel() {
        return pictureMapper.findCaRousel();
    }*/
}
